#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    void moveZeroes(vector<int>& nums) {

        if (nums.size() == 1)
        {
            return;
        }

        int cur = 0;
        int prev = 1;

        while (prev < nums.size())
        {
            if (nums[cur] == 0 && nums[prev] != 0)
            {
                int tmp = nums[cur];
                nums[cur] = nums[prev];
                nums[prev] = tmp;
                cur++;
                prev++;
            }
            else if (nums[cur] == 0 && nums[prev] == 0)
            {
                prev++;
            }
            else
            {
                cur++;
                prev++;
            }

        }

    }
};